<template>
  <div class="Tixian">
    <div class="head">
      <div
        class="left"
        :class="{ active: active == 1 ? true : false }"
        @click="chooseType(1)"
      >
        <div>换钻石</div>
        <span class="line"></span>
      </div>
      <div
        @click="chooseType(2)"
        class="right"
        :class="{ active: active == 2 ? true : false }"
      >
        <div>提现</div>
        <span class="line"></span>
      </div>
    </div>
    <div class="content1">
      <div class="card">
        <img class="wenhao" src="../assets/image/wenhao.png" alt="" />
        <h2>
          <div>
            <span>
              <img src="../assets/image/yezi.png" alt="" />
            </span>
            4256
          </div>
        </h2>
      </div>
      <div v-if="active == 2" class="help">
        <span></span>
        <span @click="yeziRecord('1')">提现记录</span>
      </div>
      <div v-else class="help">
        <span @click="yeziRecord('2')">获取记录</span>
        <span @click="yeziRecord('3')">兑换记录</span>
      </div>
      <div class="content">
        <van-row gutter="10">
          <van-col span="12" v-for="item in list" :key="item.id">
            <div
              class="item"
              @click="choose(item.id)"
              :class="{ border: activeId == item.id }"
            >
              <div class="item_head">
                <div class="item_head_item">
                  <div class="item_head_content">
                    <span v-if="active == 2">¥</span>
                    <img
                      v-if="active == 1"
                      src="../assets/image/jinbi.png"
                      alt=""
                    />
                    {{ item.number }}
                    <span v-if="active == 2">元</span>
                  </div>
                </div>
              </div>
              <div class="line"></div>
              <div class="foot">
                <img src="../assets/image/yezi.png" alt="" />
                <span>{{ item.price }}</span>
              </div>
            </div>
          </van-col>
          <van-col v-if="list.length % 2 != 0" span="12"></van-col>
        </van-row>
      </div>
      <div class="submitBtn" @click="submit">提交</div>
      <div class="agreement"><span>服务协议</span></div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      active: 2,
      activeId: "",
      list: [
        { id: 232, number: "342", price: "434" },
        { id: 23122, number: "32", price: "34" },
        { id: 2232, number: "34", price: "43" },
        { id: 2233, number: "34", price: "43" },
      ],
    };
  },
  methods: {
    chooseType(value) {
      this.active = value;
      // this.list = [];
      // this.finished = false;
      // this.total = "";
      // this.page = 1;
      // this.onLoad();
    },
    choose(id) {
      this.activeId = id;
    },
    yeziRecord(type) {
      this.$router.push({
        path: "/yeziRecord",
        query: {
          type,
        },
      });
    },
    submit() {
      if (!this.activeId) {
        this.$toast({
          message: "请选择套餐",
          position: "bottom",
        });
        return;
      }
      if (this.active == 2) {
        this.$router.push({
          path: "/WithdrawalWay",
          query: {
            id: this.activeId,
          },
        });
      }
    },
  },
};
</script>

<style lang="less" scoped>
.Tixian {
  min-height: 100%;
  .content1 {
    padding: 15px;
  }
  .card {
    height: 88px;
    background: url(../assets/image/tixianCard.png) no-repeat;
    background-size: 100% 100%;
    position: relative;
    padding-top: 26px;
    box-sizing: border-box;
    .wenhao {
      position: absolute;
      top: 5px;
      right: 5px;
      width: 16px;
      height: 16px;
    }
    h2 {
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: space-around;
      div {
        display: flex;
        align-items: center;
        font-size: 24px;
        font-family: Alibaba PuHuiTi;
        font-weight: bold;
        line-height: 33px;
        color: #ffffff;
        img {
          width: 30px;
          height: 30px;
          margin-right: 8px;
        }
      }
    }
  }
  .btn {
    margin-top: 10px;
    height: 50px;
    background: linear-gradient(87deg, #9981ed 0%, #b871ff 100%);
    border-radius: 8px;
    font-size: 17px;
    font-family: PingFang SC;
    font-weight: 500;
    line-height: 50px;
    color: #ffffff;
    text-align: center;
  }
  .txt {
    margin-top: 10px;
    text-align: right;
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: 400;
    line-height: 21px;
    color: #9981ed;
  }
  .content {
    margin-top: 10px;
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    .item {
      height: 120px;
      background: #f5f2ff;
      border-radius: 4px;
      margin-bottom: 10px;
      box-sizing: border-box;
      .item_head {
        padding: 10px 19px 9px;
        height: 64px;
        .item_head_item {
          box-sizing: border-box;
          width: 100%;
          height: 100%;
          padding: 5px 6px;
          background: url(../assets/image/txbg.png);
          background-size: 100% 100%;
          .item_head_content {
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            border: 2px solid #b298f3;
            line-height: 54px;
            color: #fff;
            font-weight: bold;
            font-size: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            img {
              width: 20px;
              height: 20px;
              margin-right: 5px;
            }
            span {
              margin-right: 5px;
              font-weight: bold;
              font-size: 20px;
            }
          }
        }
      }
      .line {
        height: 1px;
        background-color: #fff;
      }
      .foot {
        display: flex;
        justify-content: center;
        align-items: center;
        padding-top: 10px;
        img {
          width: 16px;
          height: 16px;
          margin-right: 5px;
        }
        span {
          font-size: 15px;
          font-family: PingFang SC;
          font-weight: 400;
          line-height: 21px;
          color: #2f2550;
        }
      }
    }
  }
  .head {
    display: flex;
    border-bottom: 1px solid #f6f6f6;
    padding-top: 15px;
    padding-bottom: 2px;
    .left,
    .right {
      width: 50%;
      text-align: center;
      font-size: 15px;
      font-family: PingFang SC;
      font-weight: 400;
      line-height: 21px;
      color: #666666;
    }
    .active {
      div {
        font-weight: bold;
        color: #333333;
      }
      .line {
        width: 10px;
        height: 2px;
        display: block;
        background: #9981ed;
        border-radius: 3px;
        margin: 0 auto;
      }
    }
  }
  .help {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    color: #9981ed;
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: 400;
    line-height: 21px;
  }
  .submitBtn {
    width: 100%;
    height: 50px;
    text-align: center;
    line-height: 50px;
    background: linear-gradient(90deg, #9981ed 0%, #b871ff 100%);
    font-size: 17px;
    color: #ffffff;
    border-radius: 25px;
  }
  .agreement {
    text-align: center;
    margin-top: 10px;
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: 400;
    color: #9981ed;
  }
  .border {
    // border: 2px solid transparent;
    border-style: solid;
    border-width: 2px;
    border-image: linear-gradient(#dd7dff, #3e86ff) 30 30;
    // -webkit-border-image: linear-gradient(#dd7dff, #3e86ff) 30 30;
    border-image: -moz-linear-gradient(#dd7dff, #3e86ff) 30 30;
  }
}
</style>